//
//  WHPackageBillCell.m
//  SquirrelSeller
//
//  Created by 邓伟浩 on 2019/1/12.
//  Copyright © 2019 邓伟浩. All rights reserved.
//

#import "WHPackageBillCell.h"

@interface WHPackageBillCell ()

@property (nonatomic, strong) UILabel *coopLabel;
@property (nonatomic, strong) UILabel *transLabel;
@property (nonatomic, strong) UILabel *moneyLabel;
@property (nonatomic, strong) UILabel *dateLabel;

@end

@implementation WHPackageBillCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = CViewBgMainColor;
        [self setMoneyDetailInfoUI];
    }
    return self;
}

- (void)setMoneyDetailInfoUI {
    [self.contentView addSubview:({
        _coopLabel = [[UILabel alloc] init];
        _coopLabel.textAlignment = NSTextAlignmentCenter;
        _coopLabel.adjustsFontSizeToFitWidth = YES;
        _coopLabel.textColor = CFontContentGrayColor;
        _coopLabel.font = SYSTEMFONT(kRealwidth(15));
        
        ViewBorderRadius(_coopLabel, 0, 0.5, CLineColor);
        
        _coopLabel;
    })];
    [_coopLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.left.mas_equalTo(self.contentView);
        make.width.mas_equalTo(kRealwidth(100));
    }];
    
    [self.contentView addSubview:({
        _transLabel = [[UILabel alloc] init];
        _transLabel.textAlignment = NSTextAlignmentCenter;
        _transLabel.adjustsFontSizeToFitWidth = YES;
        _transLabel.textColor = CFontContentGrayColor;
        _transLabel.font = SYSTEMFONT(kRealwidth(15));
        
        ViewBorderRadius(_transLabel, 0, 0.5, CLineColor);
        
        _transLabel;
    })];
    [_transLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(self.contentView);
        make.left.mas_equalTo(_coopLabel.mas_right);
        make.width.mas_equalTo(kRealwidth(90));
    }];
    
    [self.contentView addSubview:({
        _moneyLabel = [[UILabel alloc] init];
        _moneyLabel.textAlignment = NSTextAlignmentCenter;
        _moneyLabel.adjustsFontSizeToFitWidth = YES;
        _moneyLabel.textColor = CFontContentGrayColor;
        _moneyLabel.font = SYSTEMFONT(kRealwidth(15));
        
        ViewBorderRadius(_moneyLabel, 0, 0.5, CLineColor);
        
        _moneyLabel;
    })];
    [_moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(self.contentView);
        make.left.mas_equalTo(_transLabel.mas_right);
        make.width.mas_equalTo(kRealwidth(75));
    }];
    
    [self addSubview:({
        _dateLabel = [[UILabel alloc] init];
        _dateLabel.textAlignment = NSTextAlignmentCenter;
        _dateLabel.adjustsFontSizeToFitWidth = YES;
        _dateLabel.textColor = CFontContentGrayColor;
        _dateLabel.font = SYSTEMFONT(kRealwidth(15));
        
        ViewBorderRadius(_dateLabel, 0, 0.5, CLineColor);
        
        _dateLabel;
    })];
    [_dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(self.contentView);
        make.left.mas_equalTo(_moneyLabel.mas_right);
        make.width.mas_equalTo(kRealwidth(110));
    }];
    
}

- (void)setPackageModel:(WHPackageModel *)packageModel {
    _packageModel = packageModel;
    
    _coopLabel.text = NSStringFormat(@"  %@  ", packageModel.joinExpressUser);
    _transLabel.text = NSStringFormat(@"  %@  ", packageModel.waybillNum);
    _moneyLabel.text = NSStringFormat(@"  %@  ", packageModel.amount);
    _dateLabel.text = NSStringFormat(@"  %@  ", packageModel.closeTime);
}

@end
